// pages/app/certification/result/result.js
const app = getApp();
var host = app.globalData.host;
var self = null;

Page({
  data: {
    themeColor: '',
    themeColor2: '',
    defaultColor: '',
    borderColor: '',
    certificateItemId: '',
    isPass: false,
    correctCount: 0,
    total: 0,
    coursesLeft: 0
  },
  onLoad: function (options) {
    self = this;
    self.getStyle();
    self.setData({
      certificateItemId: options.id,
      isPass: options.isPass == 1,
      correctCount: options.correctCount,
      total: options.total,
      coursesLeft: options.coursesLeft
    })
  },
  getStyle() {
    self.setData({
      themeColor: app.globalData.themeColor,
      themeColor2: app.globalData.themeColor2,
      defaultColor: app.globalData.defaultColor,
      borderColor: app.globalData.borderColor
    })
  },
  goBack(event) {
    wx.navigateBack({
      delta: 1
    })
  },
  goReview(event) {
    wx.navigateTo({
      url: '/pages/app/certification/review/review'
    })
  },
  goBackExam(event) {
    // wx.navigateBack({
    //   delta: 2
    // })
    wx.redirectTo({
      url: '/pages/app/certification/exam/exam?id=' + self.data.certificateItemId
    })
  }
})